package com.fz.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fz.entity.Coupon;
import com.fz.entity.Goods;
import com.fz.mapper.CouponMapper;
import com.fz.service.CouponService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.sql.Wrapper;
import java.util.List;

/**
 * <p>
 * 存储优惠券信息 服务实现类
 * </p>
 *
 * @author hyr
 * @since 2025-06-18
 */
@Service
public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> implements CouponService {

    @Override
    public IPage<Coupon> getCouponsByUid(Long userId, Integer pageNo, Integer pageSize) {
        QueryWrapper<Coupon> wrapper = new QueryWrapper<>();
        wrapper.eq("user_id", userId);
        Page<Coupon> couponPage = this.page(( new Page<>(pageNo, pageSize)), wrapper);
        return couponPage;
    }
}
